package com.framework.controller;

import com.framework.exception.util.RespResult;
import com.framework.service.ActiveAgentService;
import com.framework.service.ActiveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 功能描述: 活动模块
 *
 * @author ck
 * @date 2018/11/12 19:44
 */
@RestController
@Api(value="活动模块",tags={"活动模块"})
@RequestMapping(value = "active")
public class ActiveController {

	@Autowired
	private ActiveService activeService;
	@Autowired
	private ActiveAgentService activeAgentService;
	/**
	 * 活动明细列表
	 * @param token
	 * @return
	 */
	@GetMapping("notValidate/queryActiveList")
	@ApiOperation("活动明细列表")
	public RespResult queryAddressList(String token) {
		Map<String,Object> map = activeService.queryActiveInfoList(token);
		return RespResult.ok(map);
	}

	/**
	 * 进行中活动明细
	 * @param token
	 * @return
	 */
	@GetMapping("notValidate/queryRunningActiveInfo")
	@ApiOperation("进行中活动明细")
	@ApiImplicitParams({
			@ApiImplicitParam(name="id",value="活动id",dataType="long", paramType = "query" ,required = false),
			@ApiImplicitParam(name="type",value="活动类型 1天天奖励 2周期奖励 3新手奖励 ",dataType="int", paramType = "query" ,required = false),
	})
	public RespResult queryRunningActiveInfo(String token,Long id,Integer type) {
		Map<String,Object> map = activeService.queryRunningActiveInfo(token,id,type);
		return RespResult.ok(map);
	}

	/**
	 * 历史活动明细
	 * @param token
	 * @param id
	 * @return
	 */
	@GetMapping("notValidate/queryHistoryActiveInfo")
	@ApiOperation("历史活动明细")
	@ApiImplicitParams({
			@ApiImplicitParam(name="id",value="活动id",dataType="long", paramType = "query" ,required = true),
	})
	public RespResult queryHistoryActiveInfo(String token,Long id) {
		Map<String,Object> map = activeService.queryHistoryActiveInfo(token,id);
		return RespResult.ok(map);
	}

}
